﻿<telerik:RadWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                   xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                   xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
                   x:Name="radWindow"
                   CanClose="False"
                   WindowStartupLocation="CenterScreen"
                   x:Class="Rio.Framework.Pages.ChildWindows.ChangePasswordChildWindows"
                   mc:Ignorable="d"
                   d:DesignHeight="300"
                   d:DesignWidth="400" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <telerik:RadWindow.Resources>
        <Style x:Key="ValidationSummaryStyle"
               TargetType="sdk:ValidationSummary">
            <Setter Property="IsTabStop"
                    Value="False" />
            <Setter Property="Background"
                    Value="#FFEFEFEA" />
            <Setter Property="BorderBrush"
                    Value="#FFCECEC7" />
            <Setter Property="BorderThickness"
                    Value="1" />
            <Setter Property="Padding"
                    Value="0" />
            <Setter Property="HeaderTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Border x:Name="Header"
                                Background="#FFDC020D"
                                CornerRadius="2"
                                Margin="-1,-1,-1,0">
                            <StackPanel Margin="6,2,6,4"
                                        Orientation="Horizontal"
                                        VerticalAlignment="Top">
                                <Grid Height="13"
                                      Width="13">
                                    <Ellipse Margin="0"
                                             RenderTransformOrigin="0.5,0.5">
                                        <Ellipse.Fill>
                                            <LinearGradientBrush EndPoint="0.5,1"
                                                                 StartPoint="0.5,0">
                                                <GradientStop Color="#FFFFFFFF"
                                                              Offset="0" />
                                                <GradientStop Color="#FFFDC8C8"
                                                              Offset="1" />
                                            </LinearGradientBrush>
                                        </Ellipse.Fill>
                                        <Ellipse.Stroke>
                                            <LinearGradientBrush EndPoint="0.5,0.058"
                                                                 StartPoint="0.505,0.65">
                                                <GradientStop Color="#FFCA000C"
                                                              Offset="0" />
                                                <GradientStop Color="#FFFF9298"
                                                              Offset="0.991" />
                                            </LinearGradientBrush>
                                        </Ellipse.Stroke>
                                    </Ellipse>
                                    <Path Data="M5.5,2.5 L7.5,2.5 L7.5,8 L5.5,8 M5.5,9.5 L7.5,9.5 L7.5,10.5 L5.5,10.5"
                                          Fill="#DDD43940" />
                                </Grid>
                                <TextBlock Foreground="#FFFFFFFF"
                                           FontWeight="Bold"
                                           Padding="4,1,0,0"
                                           Text="{Binding}" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ErrorStyle">
                <Setter.Value>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="ListBoxItem">
                                    <Grid Background="{TemplateBinding Background}">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="Normal" />
                                                <VisualState x:Name="MouseOver">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0"
                                                                         To=".35"
                                                                         Storyboard.TargetProperty="Opacity"
                                                                         Storyboard.TargetName="FillColor" />
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0"
                                                                         To=".55"
                                                                         Storyboard.TargetProperty="Opacity"
                                                                         Storyboard.TargetName="ContentPresenter" />
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="SelectionStates">
                                                <VisualState x:Name="Unselected" />
                                                <VisualState x:Name="Selected">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0"
                                                                         To=".75"
                                                                         Storyboard.TargetProperty="Opacity"
                                                                         Storyboard.TargetName="FillColor2" />
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Focused">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0"
                                                                                       Storyboard.TargetProperty="Visibility"
                                                                                       Storyboard.TargetName="FocusVisualElement">
                                                            <DiscreteObjectKeyFrame KeyTime="0"
                                                                                    Value="Visible" />
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Unfocused" />
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Rectangle x:Name="FillColor"
                                                   Fill="#59F7D8DB"
                                                   IsHitTestVisible="False"
                                                   Opacity="0"
                                                   RadiusY="1"
                                                   RadiusX="1" />
                                        <Rectangle x:Name="FillColor2"
                                                   Fill="#FFF7D8DB"
                                                   IsHitTestVisible="False"
                                                   Opacity="0"
                                                   RadiusY="1"
                                                   RadiusX="1" />
                                        <ContentPresenter x:Name="ContentPresenter"
                                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                                          Content="{TemplateBinding Content}"
                                                          HorizontalAlignment="Left"
                                                          Margin="{TemplateBinding Padding}" />
                                        <Rectangle x:Name="FocusVisualElement"
                                                   RadiusY="1"
                                                   RadiusX="1"
                                                   Stroke="#FFF7D8DB"
                                                   StrokeThickness="1"
                                                   Visibility="Collapsed" />
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="sdk:ValidationSummary">
                        <Grid x:Name="ValidationSummary">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="CommonStates">
                                    <VisualState x:Name="Normal" />
                                    <VisualState x:Name="Disabled">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                           Storyboard.TargetProperty="Visibility"
                                                                           Storyboard.TargetName="DisabledVisual">
                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                        Value="Visible" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ValidationStates">
                                    <VisualState x:Name="Empty">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames Duration="0"
                                                                           Storyboard.TargetProperty="Visibility"
                                                                           Storyboard.TargetName="Content">
                                                <DiscreteObjectKeyFrame KeyTime="0"
                                                                        Value="Collapsed" />
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="HasErrors" />
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Border x:Name="Content"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}"
                                    Background="{TemplateBinding Background}"
                                    CornerRadius="0,0,2,2">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <ListBox x:Name="SummaryListBox"
                                             BorderThickness="0"
                                             Background="{x:Null}"
                                             Foreground="{TemplateBinding Foreground}"
                                             Height="Auto"
                                             ItemContainerStyle="{TemplateBinding ErrorStyle}"
                                             Padding="{TemplateBinding Padding}"
                                             Grid.Row="1"
                                             Style="{TemplateBinding SummaryListBoxStyle}">
                                        <ListBox.ItemTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <TextBlock FontWeight="Bold"
                                                               Margin="4,0,0,0"
                                                               Text="{Binding MessageHeader}"
                                                               Visibility="Collapsed" />
                                                    <TextBlock Margin="4,0,0,0"
                                                               Text="{Binding Message}" />
                                                </StackPanel>
                                            </DataTemplate>
                                        </ListBox.ItemTemplate>
                                    </ListBox>
                                    <Border x:Name="DisabledVisual"
                                            Background="#80FFFFFF"
                                            IsHitTestVisible="True"
                                            Grid.RowSpan="2"
                                            Visibility="Collapsed" />
                                    <ContentControl x:Name="HeaderContentControl"
                                                    ContentTemplate="{TemplateBinding HeaderTemplate}"
                                                    Content="{TemplateBinding Header}"
                                                    HorizontalContentAlignment="Stretch"
                                                    IsTabStop="False"
                                                    VerticalContentAlignment="Center" />
                                </Grid>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </telerik:RadWindow.Resources>

    <Grid x:Name="LayoutRoot"
          Background="White"
          Margin="10">

        <Grid.RowDefinitions>
            <RowDefinition Height="40" />
            <RowDefinition Height="40" />
            <RowDefinition Height="40" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="350" />
        </Grid.ColumnDefinitions>

        <TextBlock Name="ActualPasswordTextBlock"
                   TextWrapping="Wrap"
                   Text="Mot de passe actuel :"
                   VerticalAlignment="Center" />
        <TextBlock Name="NewPasswordTextBlock"
                   Grid.Row="1"
                   TextWrapping="Wrap"
                   Text="Nouveau mot de passe :"
                   VerticalAlignment="Center" />
        <TextBlock Name="NewPasswordConfirmTextBlock"
                   Grid.Row="2"
                   TextWrapping="Wrap"
                   Text="Confirmation du nouveau mot de passe :"
                   VerticalAlignment="Center" />
        <PasswordBox Grid.Column="1"
                     VerticalAlignment="Center"
                     Margin="10,0"
                     MaxLength="20"
                     Password="{Binding OldPassword, ElementName=radWindow, Mode=TwoWay, NotifyOnValidationError=True}" />
        <PasswordBox Grid.Column="1"
                     Grid.Row="1"
                     VerticalAlignment="Center"
                     Margin="10,0"
                     MaxLength="20"
                     Password="{Binding NewPassword, ElementName=radWindow, Mode=TwoWay, NotifyOnValidationError=True}" />
        <PasswordBox Grid.Column="1"
                     Grid.Row="2"
                     VerticalAlignment="Center"
                     Margin="10,0"
                     MaxLength="20"
                     Password="{Binding NewPasswordConfirm, ElementName=radWindow, Mode=TwoWay, NotifyOnValidationError=True}" />

        <sdk:ValidationSummary Name="ValidationSummary"
                               Grid.Row="3"
                               Grid.ColumnSpan="2"
                               Margin="10"
                               ScrollViewer.HorizontalScrollBarVisibility="Auto"
                               ScrollViewer.VerticalScrollBarVisibility="Auto"
                               Style="{StaticResource ValidationSummaryStyle}" />
        <StackPanel Grid.Row="4"
                    Grid.ColumnSpan="2"
                    Orientation="Horizontal"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Center"
                    Margin="0,0,0,5">
            <telerik:RadButton x:Name="ValidateButton"
                               Content="Valider"
                               Width="75"
                               Height="25"
                               Click="ValidateButton_Click" />
            <telerik:RadButton x:Name="CancelButton"
                               Content="Annuler"
                               Width="75"
                               Height="25"
                               Margin="10,0,0,0"
                               Click="CancelButton_Click" />
        </StackPanel>
        <TextBlock Name="NoteTextBlock"
                   Grid.Row="5"
                   TextWrapping="Wrap"
                   Text="Attention : Après changement du mot de passe, vous serez déconnecté."
                   Grid.ColumnSpan="2"
                   VerticalAlignment="Center"
                   Margin="5"
                   FontStyle="Italic" />

        <telerik:RadBusyIndicator x:Name="BusyIndicator"
                                  Visibility="Collapsed"
                                  IsBusy="True"
                                  Content=""
                                  Grid.ColumnSpan="2"
                                  Grid.RowSpan="6"
                                  BusyContent=""
                                  d:IsHidden="True" />

    </Grid>
</telerik:RadWindow>
